package src.pta05;

import java.util.*;

public class Main02 {

	public static void main(String[] args) {
		 Set<String> set = new TreeSet();  
		
		 Scanner in = new Scanner(System.in);
		 while(in.hasNext()){
			 String s = in.next();
			 if (s.equals("!!!!!"))break;
			 set.add(s);
		 }
		 System.out.println(set.size());			 
			for (int i = 0; i < 10 ; i++) {
				System.out.println(set.toArray()[i]);
			}
	}
}